<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
<!-- 1903010328 信息查询、获取 -->
<?php
    include "../../inc/data/conn.php";
   	$str = $_GET['q'];
  	$taskId = substr($str, 0,3);
  	$stuClass = substr($str, 2);
    $sql = "select coname,cotype,coexam,classname,taskterm,tename 
    	from mamx_course,mamx_task,mamx_teacher 
    	where mamx_course.coid=mamx_task.coid 
    	and mamx_task.teid=mamx_teacher.teid
      	and classname=? and taskid=?  ";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("is",$stuClass,$taskId);
    $stmt->execute();
    $stmt->bind_result($coName,$coType,$coExam,$stuClass,$taskTerm,$teName);
    $stmt->store_result();
    $stmt->fetch();
?>
<?php
		  // 1903010328 连接数据库
		  // include "../../inc/data/conn.php";
		  // 查询
		  $sql1 = "select classname,mamx_stu.stuid,stuname,scnormal,scmidterm,sclab,scfinal,scoverall
		  		from mamx_stu,mamx_score
		  		where mamx_stu.stuid=mamx_score.stuid 
		  		and classname= ?
		  		and taskid= ?";
		  $stmt1 = $conn->prepare($sql1);
		  // 1903010328 执行查询
		  $stmt1->bind_param("si",$stuClass,$taskId);
		  $stmt1->execute();
		  //  1903010328 保存结果
		  
		  $stmt1->bind_result($stuClass,$stuId,$stuName,$scNormal,$scMidterm,$scLab,$scFinal,$scOverall);
		  $stmt1->store_result();
		  //  1903010328 获取记录
		  $stmt1->fetch();
?>
	<form action="doScIn.php" method="post" enctype="multipart/form-data">
		<table>
			<tr>
	    		<td width="639px;"><p>教师姓名：<?=$teName?></p></td>
	    		<td><p>课程名称：<?=$coName?></p></td>
	    	</tr>
	    	<tr>
	    		<td><p>班级：<?=$stuClass?></p></td>
	    		<td><p>学年学期：<?=$taskTerm?></p></td>
	    	</tr>
	    	<tr>
	    		<td><p>课程性质：<?=$coType?></p></td>
	    		<td><p>考核方式：<?=$coExam?></p></td>
	    	</tr>
	    	<tr>
	    		<td><p>输入规范提示：数字成绩不得超过100分。</p></td>
	    		<td><p>输入计分制：总评好成绩保存为：</p></td>
	    	</tr>
	    	<tr>
	    		<td colspan="2">
	    			<p>平时(%)</p>
	    			<input type="text" placeholder="0">
	    			<p>期中(%)</p>
	    			<input type="text" placeholder="0">
	    			<p>实验(%)</p>
	    			<input type="text" placeholder="0">
	    			<p>期末(%)</p>
	    			<input type="text" placeholder="0">
	    			<p id="d1">折算总评成绩之前请先清空总评成绩。</p>
	    			<button type="button" id="d2">清空总评成绩</button> 
	    		</td>
	    	</tr>
	    	<tr>
	    		<td colspan="2">
				    <a href="/28/school/downxls.php">
				    <input type="button" value="成绩下载模板" id="d2"></a>Excel成绩文件
				    <input type="file" value="选择文件" name="scorefile" id="d3">
				    <input type="hidden" name="taskid" value="<?=$taskId?>">
				    <input type="submit" value="载入" id="d2">
			    </td>
	    	</tr>
	    </table>
	    <div id="execl">
	    
		<?php
		  if ($stmt1->num_rows > 0){
		?>
		<table  id="table"  width="1100px" border="2px">
		    <tr>
		        <td>序号</td>
		        <td>班级</td>
		        <td>学号</td>
		        <td>姓名</td>
		        <td>平时成绩</td>
		        <td>期中成绩</td>
		        <td>实验成绩</td>
		        <td>期末成绩</td>
		        <td>总评成绩</td>
		    </tr>
		    <tr >
				<?php
    for ($i=1;$stmt1->fetch();$i++){
    ?>
    <tr>
        <td><?=$i?></td>
        <td><?=$stuClass?></td>
        <td><?=$stuId?></td>
        <td><?=$stuName?></td>
        <td><?=$scNormal?></td>
        <td><?=$scMidterm?></td>
        <td><?=$scLab?></td>
        <td><?=$scFinal?></td>
        <td><?=$scOverall?></td>
    </tr>
     <?php
    }
    ?>
</table>
   <?php
    }
    else{
      echo"暂时没有成绩记录！" ;
    } 
    ?>
	    	</div>
	    	<!--按钮区域-->
	    <div id="btt">
	    	<input type="submit" id="d4" value="保存" style="background-color:#1D50A2;color:white"></input>
	    	<input type="button" id="d2" value="成绩校对打印" style="background-color:#1D50A2;color:white"></input>  
	    	<input type="submit" id="d4" value="提交" style="background-color:#1D50A2;color:white"></input>
	    	<input type="button" id="d2" value="成绩输出打印" style="background-color:#1D50A2;color:white"></input>  
 			<input type="button" id="d2" value="学生照片查看" style="background-color:#1D50A2;color:white"></input>  
	    </div>
	    <!--按钮区域结束-->
	    </form>
</body>
</html>